function [p, pG, pB] = binaryModel(m, piG, piB, mu, lambda, lossAversion)


upside = piG + m;
downside = lossAversion * (piB + m);


f = @(p) mu / (p + (exp(upside /lambda) - 1)^(-1)) + (1 - mu) / (p + (exp(downside /lambda) - 1)^(-1));

p = fzero(f, 0.5);

if mu * (piG + m) + (1 - mu) * (piB + m) >= 0 && (p >= 1 || p <= 0) 
    priorBased = 1;
    p = priorBased; 
elseif  mu * (piG + m) + (1 - mu) * (piB + m) <= 0 && (p >= 1 || p <= 0) 
    priorBased = 0;
    p = priorBased;
end


pG = (1 + (1/p - 1) * exp(-(piG + m)/lambda))^(-1);
pB = (1 + (1/p - 1) * exp(-(piB + m)/lambda))^(-1);



